package com.lanou.fooddemo.theme;

import android.util.Log;

import com.lanou.fooddemo.R;

/**
 * Created by dllo on 2015/8/17.
 */
public class FoodTheme {
    public static final String NAME = "theme";
    public static final String TYPE_RED = "redTheme";
    public static final String TYPE_BLUE = "blueTheme";

    /**
     * 记录当前主题
     */
    private static String currentTheme = TYPE_RED;

    //当前主题属性值
    private static int toastLayout = ThemeRed.TOAST_LAYOUT;
    private static int tabSameCity = ThemeRed.TAB_SAME_CITY;
    private static int tabRecommend = ThemeRed.TAB_RECOMMEND;
    private static int tabTopic = ThemeRed.TAB_TOPIC;
    private static int tabSelected = ThemeRed.TAB_SELECTED;
    private static int mainTabTabLineColor = ThemeRed.MAIN_TAB_TAB_LINE_COLOR;
    private static int headerLayoutColor = ThemeRed.HEADER_LAYOUT_COLOR;
    private static int basketMenu = ThemeRed.BASKET_MENU;
    private static int foodAllMenu = ThemeRed.FOOD_ALL_MENU;
    private static int foodDeleteMenu = ThemeRed.FOOD_DELETE_MENU;
    private static int loadingLayoutProcessColor = ThemeRed.LOADING_LAYOUT_PROCESS_COLOR;
    private static int circleProgressBarColor = ThemeRed.CIRCLE_PROGRESS_BAR_COLOR;
    private static int mainTabActivityLeftMenuColor = ThemeRed.MAIN_TAB_ACTIVITY_LEFT_MENU_COLOR;
    private static int toggleMenuButton = ThemeRed.TOGGLE_MENU_BUTTON;

    private class ThemeBlue {
        public static final int TOAST_LAYOUT = 0x771D90FF;
        public static final int TAB_SAME_CITY = R.drawable.tab_same_city_selector_blue;
        public static final int TAB_RECOMMEND = R.drawable.tab_recommend_selector_blue;
        public static final int TAB_TOPIC = R.drawable.tab_topic_selector_blue;
        public static final int TAB_SELECTED = R.drawable.tab_seleted_selector_blue;
        public static final int MAIN_TAB_TAB_LINE_COLOR = android.R.color.holo_blue_light;
        public static final int HEADER_LAYOUT_COLOR = android.R.color.holo_blue_light;
        public static final int BASKET_MENU = R.mipmap.basket_blue;
        public static final int FOOD_ALL_MENU = R.mipmap.food_all_blue;
        public static final int FOOD_DELETE_MENU = R.mipmap.food_delete_blue;
        public static final int LOADING_LAYOUT_PROCESS_COLOR = android.R.color.holo_blue_light;
        public static final int CIRCLE_PROGRESS_BAR_COLOR = android.R.color.holo_blue_light;
        public static final int MAIN_TAB_ACTIVITY_LEFT_MENU_COLOR = android.R.color.holo_blue_light;
        public static final int TOGGLE_MENU_BUTTON = R.mipmap.menu_open_blue;
    }
    public class ThemeRed {
        public static final int TOAST_LAYOUT = 0x77EF087F;
        public static final int TAB_SAME_CITY = R.drawable.tab_same_city_selector;
        public static final int TAB_RECOMMEND = R.drawable.tab_recommend_selector;
        public static final int TAB_TOPIC = R.drawable.tab_topic_selector;
        public static final int TAB_SELECTED = R.drawable.tab_seleted_selector;
        public static final int MAIN_TAB_TAB_LINE_COLOR = android.R.color.holo_red_light;
        public static final int HEADER_LAYOUT_COLOR = android.R.color.holo_red_light;
        public static final int BASKET_MENU = R.mipmap.basket;
        public static final int FOOD_ALL_MENU = R.mipmap.food_all;
        public static final int FOOD_DELETE_MENU = R.mipmap.food_delete;
        public static final int LOADING_LAYOUT_PROCESS_COLOR = android.R.color.holo_red_light;
        public static final int CIRCLE_PROGRESS_BAR_COLOR = android.R.color.holo_red_light;
        public static final int MAIN_TAB_ACTIVITY_LEFT_MENU_COLOR = android.R.color.holo_red_light;
        public static final int TOGGLE_MENU_BUTTON = R.mipmap.menu_open;
    }

    public static String getCurrentTheme() {
        return currentTheme;
    }

    /**
     * 设置主题
     */
    public static void setTheme(String theme) {
        Log.i("liuyann", "theme name = " + theme);
        currentTheme = theme;
        if (TYPE_RED.equals(currentTheme)) {
            toastLayout = ThemeRed.TOAST_LAYOUT;
            tabSameCity = ThemeRed.TAB_SAME_CITY;
            tabRecommend = ThemeRed.TAB_RECOMMEND;
            tabTopic = ThemeRed.TAB_TOPIC;
            tabSelected = ThemeRed.TAB_SELECTED;
            mainTabTabLineColor = ThemeRed.MAIN_TAB_TAB_LINE_COLOR;
            headerLayoutColor = ThemeRed.HEADER_LAYOUT_COLOR;
            basketMenu = ThemeRed.BASKET_MENU;
            foodAllMenu = ThemeRed.FOOD_ALL_MENU;
            foodDeleteMenu = ThemeRed.FOOD_DELETE_MENU;
            loadingLayoutProcessColor = ThemeRed.LOADING_LAYOUT_PROCESS_COLOR;
            circleProgressBarColor = ThemeRed.CIRCLE_PROGRESS_BAR_COLOR;
            mainTabActivityLeftMenuColor = ThemeRed.MAIN_TAB_ACTIVITY_LEFT_MENU_COLOR;
            toggleMenuButton = ThemeRed.TOGGLE_MENU_BUTTON;
        } else if (TYPE_BLUE.equals(currentTheme)){
            toastLayout = ThemeBlue.TOAST_LAYOUT;
            tabSameCity = ThemeBlue.TAB_SAME_CITY;
            tabRecommend = ThemeBlue.TAB_RECOMMEND;
            tabTopic = ThemeBlue.TAB_TOPIC;
            tabSelected = ThemeBlue.TAB_SELECTED;
            mainTabTabLineColor = ThemeBlue.MAIN_TAB_TAB_LINE_COLOR;
            headerLayoutColor = ThemeBlue.HEADER_LAYOUT_COLOR;
            basketMenu = ThemeBlue.BASKET_MENU;
            foodAllMenu = ThemeBlue.FOOD_ALL_MENU;
            foodDeleteMenu = ThemeBlue.FOOD_DELETE_MENU;
            loadingLayoutProcessColor = ThemeBlue.LOADING_LAYOUT_PROCESS_COLOR;
            circleProgressBarColor = ThemeBlue.CIRCLE_PROGRESS_BAR_COLOR;
            mainTabActivityLeftMenuColor = ThemeBlue.MAIN_TAB_ACTIVITY_LEFT_MENU_COLOR;
            toggleMenuButton = ThemeBlue.TOGGLE_MENU_BUTTON;
        }
    }
    /**
     * 标题背景颜色获取
     */
    public static int getHeaderLayoutColor() {
        return headerLayoutColor;
    }

    /**
     * 获取Toast背景颜色
     */
    public static int getToastLayoutColor() {
        return toastLayout;
    }

    /**
     * 同城tabView背景image
     * @return
     */
    public static int getTabSameCityImage() {
        return tabSameCity;
    }

    /**
     * 推荐tabView背景image
     * @return
     */
    public static int getTabRecommendImage() {
        return tabRecommend;
    }

    /**
     * 话题tabView背景image
     * @return
     */
    public static int getTabTopicImage() {
        return tabTopic;
    }

    /**
     * 精选tabView背景image
     * @return
     */
    public static int getTabSelectedImage() {
        return tabSelected;
    }

    /**
     * Tab上的线条颜色
     * @return
     */
    public static int getMainTabTabLineColor() {
        return mainTabTabLineColor;
    }

    /**
     * 篮子主菜单image
     * @return
     */
    public static int getBasketMenu() {
        return basketMenu;
    }

    /**
     * 所有食物子菜单
     * @return
     */
    public static int getFoodAllMenu() {
        return foodAllMenu;
    }

    /**
     * 删除食物子菜单
     * @return
     */
    public static int getFoodDeleteMenu() {
        return foodDeleteMenu;
    }

    /**
     * 刷新布局进度条颜色
     * @return
     */
    public static int getLoadingLayoutProcessColor() {
        return loadingLayoutProcessColor;
    }

    /**
     * 圆形刷新中视图颜色
     * @return
     */
    public static int getCircleProgressBarColor() {
        return circleProgressBarColor;
    }

    /**
     * 主Activity左侧菜单颜色
     * @return
     */
    public static int getMainTabActivityLeftMenuColor() {
        return mainTabActivityLeftMenuColor;
    }
    public static int getToggleMenuButton() {
        return toggleMenuButton;
    }
}
